var mongoose =require('mongoose');
var Schema = mongoose.Schema;

var Topic = new Schema({
    title: {type: String},
    content: {type: String},
    image: {type: String},
    creator: {type: Schema.Types.ObjectId, ref: 'User'},
    creatTime: {type: Date, default: Date.now},
    faction: {type: Schema.Types.ObjectId, ref: 'Faction'},

    hasDelete: {type: Boolean, default:false},
    hasLocked: {type: Boolean, default:false},
    replyCount: {type: Number, default: 0},
    replys: [{type: Schema.Types.Mixed}], // 回复信息
    lastReplyTime: {type: Date, default: Date.now}
})

mongoose.model('Topic', Topic);